<!--新登录开始-->
	<div id="login_div" class="modal fade login-bg" tabindex="-1" style="display: none;">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close text-primary" data-dismiss="modal" aria-hidden="true">×</button>
					<h4 class="modal-title text-info">欢迎登录</h4>
				</div>
				<div class="modal-body">
					<form class="form-horizontal text-info text-center" role="form" method="post" id="login_form" action="/login/user.htm">
						<div class="row">
							<div class="col-sm-offset-1 col-md-11">
								<div class="form-group">
									<label for="inputEmail3" class="col-sm-3 control-label">用户名</label>
									<div class="col-sm-5">
										<input type="text" class="form-control" id="userName" name="userName" placeholder="Username"></div>
									<label class="col-sm-3 control-label text-warning">
										<strong class="pull-left">*</strong>
									</label>
								</div>
								<div class="form-group">
									<label for="inputPassword3" class="col-sm-3 control-label">密码</label>
									<div class="col-sm-5">
										<input type="password" class="form-control" id="userPass" name="userPass" placeholder="Password"></div>
									<label class="col-sm-3 control-label pull-left text-warning">
										<strong class="pull-left">*</strong>
									</label>
								</div>
								<div class="form-group">
									<div class="col-sm-offset-3 col-sm-5">
										<button class="btn btn-success pull-right" type="submit" id="login_btn">
											<span class="glyphicon glyphicon-ok"></span>
											&nbsp;&nbsp;登入
										</button>
										<button type="button" class="btn btn-danger" data-dismiss="modal">暂不</button>
									</div>
								</div>
							</div>

						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<!--新登录结束-->

	<!-- 注册开始 -->
	<!-- 注册表单验证参考登录的来做 -->
	<form class="form-horizontal text-info" role="form" method="post" enctype="multipart/form-data" id="reg_form" action="/user/register.htm">
	<div id="reg_div" class="modal fade login-bg" tabindex="-1" style="display: none;">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close text-primary" data-dismiss="modal" aria-hidden="true">×</button>
					<h4 class="modal-title text-info">欢迎留下你的足迹</h4>
				</div>
				<div class="modal-body">
						<div class="form-group text-center">
							<label for="inputEmail3" class="col-sm-3 control-label text-info">用户头像</label>
							<div class="col-sm-6">
								<div class="fileupload fileupload-new" data-provides="fileupload">
									<div class="fileupload-new thumbnail" style="width: 150px; height: 150px;">
										<img src="" data-src="holder.js/150x150" alt="100x100"></div>
									<div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 150px; max-height: 150px; line-height: 20px;"></div>
									<div>
										<span class="btn btn-file">
											<span class="btn btn-success fileupload-new">选择头像</span>
											<span class="btn btn-success fileupload-exists">修改头像</span>
											<input type="file" name="file"/>
										</span>
										<a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">删除头像</a>
									</div>
								</div>
							</div>
						</div>
						<div class="form-group">
							<label for="inputEmail3" class="col-sm-3 control-label text-info">用户名</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" id="userName" name="userName" placeholder="Username"></div>
							<label class="col-sm-1 control-label  text-warning">
								<strong class="pull-left">*</strong>
							</label>
						</div>
						<div class="form-group">
							<label for="inputEmail3" class="col-sm-3 control-label text-info">EMAIL</label>
							<div class="col-sm-6">
								<input type="email" class="form-control" id="userEmail" name="userEmail" placeholder="Email"></div>
							<label class="col-sm-1 control-label text-warning">
								<strong class="pull-left">*</strong>
							</label>
						</div>
						<div class="form-group">
							<label for="inputPassword3" class="col-sm-3 control-label text-info">密码</label>
							<div class="col-sm-6">
								<input type="password" class="form-control" id="userPass" name="userPass" placeholder="Password"></div>
							<label class="col-sm-1 control-label text-warning">
								<strong class="pull-left">*</strong>
							</label>
						</div>
						<div class="form-group">
							<label for="inputPassword3" class="col-sm-3 control-label text-info">重复密码</label>
							<div class="col-sm-6">
								<input type="password" class="form-control" id="rePass" name="rePass" placeholder="RePassword"></div>
							<label class="col-sm-1 control-label text-warning">
								<strong class="pull-left">*</strong>
							</label>
						</div>
						<div class="form-group">
							<div class="col-sm-offset-3 col-sm-6">
								<button type="button" class="btn btn-danger" data-dismiss="modal">暂不</button>
								<button class="btn btn-success pull-right" type="submit">
									<span class="glyphicon glyphicon-ok"></span>
									&nbsp;&nbsp;注册
								</button>
							</div>
						</div>
					
				</div>
			</div>
		</div>
	</div>
	</form>
	<script type="text/javascript" src="/static/client/js/bootbox.js"></script>
	<script type="text/javascript">
	//http://jqueryvalidation.org/
	$(function(){
		//弹出警告框设置http://bootboxjs.com/#about
		bootbox.setDefaults({
			locale: "zh_CN"
		});
	
		$("#reg_form").validate({
			submitHandler: function(form) {
			    $(form).ajaxSubmit({
			    	success:function(data){
			    		bootbox.alert(data.msg);
			    		if(data.status=="success"){
			    			$("[name='file']").val("");
			    			$('.form-control').val("");
			    			$('#reg_div').modal('hide');
			    			$('div.fileupload-new').show();
			    			$('span.btn.btn-success.fileupload-new').show();
			    			$('span.fileupload-exists').hide();
			    			$('div.fileupload-preview').html("");
			    			$('div.fileupload-preview').hide();
			    			$('a.fileupload-exists').hide();
			    		}
			    	}
			    });
			 },
			rules: {
				userName:{
					required: true,
					minlength: 4
				},
				userPass:{
					required: true,
					minlength: 6
				},
				userEmail:{
					required: true,
					email:true
				},
				rePass:{
					required: true,
					minlength: 6,
					equalTo: "#userPass"
				}
			},
			messages:{
				userName:{
					required: "请输入用户名",
					minlength: "用户名长度最少为4"
				},
				userPass:{
					required: "请输入密码",
					minlength: "密码长度最少为6"
				},
				userEmail:"请输入正确邮箱地址",
				rePass:{
					required: "请再次输入密码",
					minlength: "密码长度最少为6",
					equalTo: "密码输入不一致"
				}
			}
			
		});
		$("#login_form").validate({
			submitHandler: function(form) {
			    $(form).ajaxSubmit({
			    	success:function(data){
			    		bootbox.alert(data.msg);
			    		if(data.status=="success"){
			    			$('.form-control').val("");
			    			$('#login_div').modal('hide');
			    			window.location.reload();
			    		}
			    	}
			    });
			 },
			rules: {
				userName:{
					required: true,
					minlength: 4
				},
				userPass:{
					required: true,
					minlength: 6
				}
			},
			messages:{
				userName:{
					required: "请输入用户名",
					minlength: "用户名长度最少为4"
				},
				userPass:{
					required: "请输入密码",
					minlength: "密码长度最少为6"
				}
			}
			
		});
	
	});
	
	</script>